package com.xgry.bpm.api.base.user.service.impl;

import com.xgry.bpm.api.base.entity.Permission;
import com.xgry.bpm.api.base.entity.Role;
import com.xgry.bpm.api.base.user.entity.User;
import com.xgry.bpm.api.base.user.service.UserService;
import org.springframework.stereotype.Service;

import java.util.HashSet;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public User findByUsername(String username) {
        User user = new User();
        user.setPassword("1234566");
        user.setUid(1);
        user.setUsername("张三");
        HashSet<Role> roles = new HashSet<>();
        roles.add(new Role(){{
            this.setRid(1);
            this.setRname("管理员");
            this.setPermissions(new HashSet<Permission>(){{
                this.add(new Permission(){{
                    this.setName("权限");
                    this.setPid(1);
                    this.setUrl("localhost:8080");
                }});
            }});
        }});
        user.setRoles(roles);
        return user;
    }
}
